<?php

namespace Models;
use Phalcon\Mvc\Model\Behavior\SoftDelete;
class CouponCard extends BaseModel
{
    public function initialize()
    {
        $this->hasMany("id", "Models\CouponUser", "cid", array('alias' => 'CouponUser'));
        $this->addBehavior(new SoftDelete(
            array(
                'field' => 'del',
                'value' => App::DELETED
            )
        ));
    }

    public function notSave()
    {
        $flash = $this->getDI()->getFlash();
        foreach ($this->getMessages() as $message) {
            $flash->error($message);
        }
    }


}
